<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="utf-8" />
        <title>Button - ESUI Demo</title>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="assets/google-code-prettify/prettify.css" />
        <link rel="stylesheet" href="assets/themes/standard.css" />
        <!--[if lt IE 9]>
        <link rel="stylesheet" href="assets/ie8.css" />
        <![endif]-->
    </head>
<body>
    <div class="header">
        <h1 id="branding">ESUI - Button</h1>
    </div>
    <div class="ui-g main-container">
        <div id="side-bar" class="ui-u-1-5">
            <ul id="navigator" class="ui-nav">
            </ul>
        </div>
        <div id="main" class="ui-u-4-5">
            <h2>预定义样式</h2>
            <div class="intro">
                <p>使用属性<code>variants</code>可以快速创建一个带有预定义样式的按钮。</p>
            </div>
            <div class="example">
                <button type="button" data-ui="type:Button;">Button</button>
                <button type="button" data-ui="type:Button;variants:primary">Primary</button>
                <button type="button" data-ui="type:Button;variants:success">Success</button>
                <button type="button" data-ui="type:Button;variants:info">info</button>
                <button type="button" data-ui="type:Button;variants:warning">warning</button>
                <button type="button" data-ui="type:Button;variants:danger">danger</button>
                <button type="button" data-ui="type:Button;variants:link">link</button>
            </div>
            <h2>尺寸</h2>
            <div class="intro">
                <p>使用类<code>.ui-x-small</code>、<code>.ui-small</code>、<code>.ui-large</code>、<code>.ui-x-large</code>、<code>.ui-xx-large</code>、<code>.ui-xxx-large</code>可以获得不同尺寸的按钮。</p>
            </div>
            <div class="example">
                <button type="button" data-ui="type:Button" class="ui-x-small">ui-x-small</button>
                <button type="button" data-ui="type:Button" class="ui-small">ui-x-small</button>
                <button type="button" data-ui="type:Button">medium</button>
                <button type="button" data-ui="type:Button" class="ui-large">ui-large</button>
                <button type="button" data-ui="type:Button" class="ui-x-large">ui-x-large</button>
                <button type="button" data-ui="type:Button" class="ui-xx-large">ui-xx-large</button>
                <button type="button" data-ui="type:Button" class="ui-xxx-large">ui-xxx-large</button>
            </div>
            
            <h2>状态</h2>
            <div class="intro">
                <p>使用类<code>.state-hover</code>、<code>.state-active</code>可以获得鼠标悬浮和激活状态的按钮，也可通过属性<code>disabled</code>设置按钮为不可用状态。</p>
            </div>
            <div class="example">
                <div data-ui="type:Button;variants:primary">Normal</div>
                <div data-ui="type:Button;variants:primary" class="state-hover">Hover</div>
                <div data-ui="type:Button;variants:primary" class="state-active">Active</div>
                <div data-ui="type:Button;variants:primary;disabled:1">Disabled</div>
            </div>
            <h2>按钮组</h2>
            <div class="intro">
                <p>创建一个按钮组，在包裹着按钮的<code>div</code>元素中添加<code>.ui-button-group</code>类即可。</p>
            </div>
            <div class="example">
                <div class="ui-button-group">
                    <div data-ui="type:Button;" class="ui-button-primary">Hello</div>
                    <div data-ui="type:Button;" class="ui-button-group-separator ui-button-primary state-active">World</div>
                    <div data-ui="type:Button;" class="ui-button-group-separator ui-button-primary">separated</div>
                </div>
                <div class="ui-button-group">
                    <div data-ui="type:Button;" class="ui-button-primary">Hello</div>
                    <div data-ui="type:Button;" class="ui-button-group-separator ui-button-primary state-active">World</div>
                    <div data-ui="type:Button;" class="ui-button-group-separator ui-button-primary">Wow</div>
                </div>
            </div>
            <h2>图标</h2>
            <div class="intro">
                <p>在按钮中包含<code>span</code>元素，并为其添加<code>.ui-icon-*</code>类即可。</p>
            </div>
            <div class="example">
                <div data-ui="type:Button;" class="ui-button-primary"><span class="ui-icon-user"></span> Icon</div>
                <div data-ui="type:Button;" class="ui-button-primary">Icon <span class="ui-icon-user"></span></div>
            </div>
            <h2>设置宽度</h2>
            <div class="intro">
                <p>使用属性<code>width</code>可以设置按钮的宽度，也可通过<code>.ui-button-fluid</code>或属性<code>fluid</code>设置全宽。</p>
            </div>
            <div class="example">
                <div class="row">
                    <div data-ui="type:Button;variants:primary;width:100">100px</div>
                </div>
                <div class="row">
                    <div data-ui="type:Button;variants:primary;width:300">300px</div>
                </div>
                <div class="row">
                    <div data-ui="type:Button;variants:success" class="ui-button-fluid">全宽</div>
                </div>
                <div class="row">
                    <div data-ui="type:Button;variants:danger fluid">全宽</div>
                </div>
            </div>
            <h2>设置内容</h2>
            <div class="intro">
                <p>使用<code>setContent</code>方法可以设置按钮的内容。</p>
            </div>
            <div class="example">
                <div data-ui="type:Button; id:content" class="ui-button-primary" id="setcontent">点击改变按钮的内容</div>
            </div>
            <script type="text/sample">
                ui.get('content').on('click', function() {
                    this.setContent('Hello');
                });
            </script>
        </div>
    </div>
    <script src="assets/loader/esl.js"></script>
    <script src="config.js"></script>
    <script src="demo.js"></script>
    <script src="assets/google-code-prettify/prettify.js"></script>
    <script id="main-js">
    require(
        [
            'esui',
            'jquery',
            'esui/Button',
            'esui/Tab',
            'demo'
        ],
        function (ui, $) {
            ui.init();
            ui.get('content').on('click', function() {
                this.setContent('Hello');
            });
        }
    );
    </script>
    <script src="sitemap.js"></script>
</body>
</html>
